<%@ page language="java" import="java.sql.*" pageEncoding="gb2312"%>
<html>
<head>
<title>登录</title>
</head>
<script type="text/javascript">
function check()// JavaScript Document
{
    var flag = true;
    if (document.form.no.value == "") {
        alert("用户名或密码不能为空");
        form.no.focus();
        flag = false; 
    } else if (document.form.psw.value == "") {
        alert("用户名或密码不能为空");
        form.psw.focus();
        flag = false;
    }
    if (flag) {
        document.form.submit();
    }
}
</script>
<style type="text/css">
body {
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
    text-align: center;
    margin: 0px auto;
}

div {
    left: 80%;
    margin-left: -530px;
    position: absolute;
}
</style>
<body background=4.jpg><font size=2>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <div>
        <font face="华文新魏">登录图书管理系统</font>
        <p>
       <body>  
 
  <form method="POST" >  
     账户: <input type="text" name="Name"><br>  
      密码: <input type="text" name="Password" ><br>  
   <input type="submit" value="提交"><br>
  <form>  
  
  <%  
      if (request.getParameter("Name") != null   
              && request.getParameter("Password") != null) {    
          String Name = request.getParameter("Name");  
          String Password = request.getParameter("Password");  
          if (Name.equals("a") && Password.equals("a")) {     
              session.setAttribute("Login", "OK");  
              session.setAttribute("myCount", new Integer(1));  
              response.sendRedirect("5.jsp");  
          }  
          else {     
              %>  
              登录失败:用户名或密码不正确～  
             <%    
          }   
      }  
%>  
      </form>
    </div>
</body>
</html>
